package com.ruoyi.common.utils;

import com.ruoyi.common.core.domain.model.LoginUser;
import org.springframework.security.core.context.SecurityContextHolder;

/**
 *
 * @author liboyu
 */
public class GetLoginUser extends LoginUser {

    public static LoginUser getLoginUser() {
        return (LoginUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    }
    public static Long id() {
        LoginUser loginUser = (LoginUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
        return getLoginUser().getUserId();
    }
}
